<?php
require_once '../php_includes.php';
	//require_once 'admin_options.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!--Get the value employee and manager ids from submitted form in order to change employee's manager id
    to submitted manager's id. If the page is access by typying instead of submitting the form, it will
    print error message and provide a link to admin change manager.
-->

<html xmlns="http://www.w3.org/1999/xhtml">

  <head>
    <title>Payroll and Timesheet Management Website</title>
    <link rel="stylesheet" type="text/css" href="../styles.css"/>
	</script>
  </head>
  <body>
  
	<?php
	//show the logo
	echo "<div class=\"logo\">\n";
	echo "	<img src=\"";
	echo "../" . $header_image;
	echo "\" alt=\"";
	echo $header_image_alt;
	echo "\" />\n";
	echo "</div>\n";
	?>
	<div class="user_links">
		<a href="adminlogs.php">Logs</a> &nbsp;&nbsp;|&nbsp;&nbsp;
		<a href="adminMessage.php">Set Admin Message</a> &nbsp;&nbsp;|&nbsp;&nbsp;
		<a href="addmanager.php">Add Manager</a> &nbsp;&nbsp;|&nbsp;&nbsp;
		<a href="adminDeletion.php">Delete Manager and Transfer Employees</a> &nbsp;&nbsp;|&nbsp;&nbsp;
		<a href="adminManager.php">Change Employee's Manager</a> &nbsp;&nbsp;|&nbsp;&nbsp;
	</div>
        <?php  //Get data values
          $employee = $_POST["Employees"];
          $manager = $_POST["Managers"];
          $check = $_POST["hide"];
          if($check != "hidden")
          {
            echo "<p> Transaction invalid. </p>";
            echo "<p><a href='adminManager.php'>Go back to Admin Change Employee's Manager</a></p>";
          }
          else
          {
            sqlConnect();
            $getId = "UPDATE Employee SET ManagerID = '$manager' WHERE EmployeeID = '$employee' ;";
            $result = sqlQuery($getId);
            sqlExit();
            echo "<p> Your transaction was successfully. </p>";
            echo "<p><a href='adminManager.php'>Go back to Admin Change Employee's Manager</a></p>";
          }
        ?>
</body>
</html>
	